package com.project.xsf.controller;

import com.project.xsf.entity.TInterposeClassify;
import com.project.xsf.entity.TInterposeFood;
import com.project.xsf.entity.TInterposeScheme;
import com.project.xsf.entity.TInterposeSprot;
import com.project.xsf.service.TInterposeClassifyService;
import com.project.xsf.service.TInterposeFoodService;
import com.project.xsf.service.TInterposeSprotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/tInterposeClassify")
public class TInterposeClassifyController {
    @Autowired
    private TInterposeClassifyService tInterposeClassifyService;
    @Autowired
    private TInterposeFoodService tInterposeFoodService;
    @Autowired
    private TInterposeSprotService tInterposeSprotService;

    @GetMapping("/queryById")
    public List<TInterposeClassify> queryById(HttpSession session){
        List<TInterposeClassify> tInterposeClassifies = tInterposeClassifyService.queryById(session);
//        System.out.println(tInterposeClassifies);
        return tInterposeClassifies;
    }
    @GetMapping("/querySprotById")
    public List<TInterposeSprot> querySprotById(HttpSession session){
        List<TInterposeSprot> tInterposeSprots = tInterposeSprotService.queryByMemberId(session);
        return tInterposeSprots;
    }
    @GetMapping("/queryFoodById")
    public List<TInterposeFood> queryFoodById(HttpSession session){
        List<TInterposeFood> tInterposeFoods = tInterposeFoodService.queryByMemberId(session);

        return tInterposeFoods;
    }
    @GetMapping("/querySchemeById")
    public List<TInterposeScheme> querySchemeById(HttpSession session){
        List<TInterposeScheme> tInterposeFoods = tInterposeClassifyService.selectByMemberId(session);

        return tInterposeFoods;
    }
}
